package NavHeaderView;

use strict;

use CGI qw(:standard);
use Athena::WebAPI::View;

use base ("View");

sub new {
  # Get the class name
  my $stInvocant = shift(@_);
  my $stClass = ref($stInvocant) || $stInvocant;

  # Create the current instance and bless into class
  my $rSelf = { };
  bless($rSelf,$stClass);

  #my %hParams = ( @_ );
  #$rSelf->{params} = \%hParams;
  $rSelf->{params} = shift(@_);

  return $rSelf;
}

sub draw {
   my $rSelf = shift(@_);
   my $stNavBar;
   my $stLbCurrent;

   $stNavBar = " ". b("ATHENA MANAGER")."&nbsp; &nbsp; ";
   
   # if ($rSelf->{params}->{'hidden_fields'}->{current_lb} eq "") {

   $stNavBar .=
     b(" &nbsp; Choose: ").
       a({-href=>'?',-onClick=>_getOnClick('ChooseMethodAction')},
	 b("LB Location"));
   $stNavBar .=
     b(" &nbsp; View: ").
       a({-href=>'?',-onClick=>_getOnClick('ViewPhysAction')},
	 b("Phys"))." ".
	 a({-href=>'?',-onClick=>_getOnClick('ViewFarmAction')},
	   b("Farm"))." ".
	   a({-href=>'?',-onClick=>_getOnClick('ViewEngineAction')},
	     b("Engine"))." ";
   $stNavBar .=
     b(" &nbsp; Update: ").
       a({-href=>'?',-onClick=>_getOnClick('UpdatePhysAction')},
	 b("Phys"))." ".
	 a({-href=>'?',-onClick=>_getOnClick('UpdateFarmAction')},
	   b("Farm"))." ";
   $stNavBar .=
     b(" &nbsp; Balance: ").
       a({-href=>'?',-onClick=>_getOnClick('BalanceAction')},
	 b("Farm"))." &nbsp; ";

   return "<font size=-1>$stNavBar</font>";
}

sub _getOnClick {
  my $stAction = shift(@_);
  my $stOnclick;
  $stOnclick = "document.myForm._action.value = '" 
    . $stAction . "';  document.myForm.submit(); return false";
  return $stOnclick;
}

1;
